home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 February / EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso / earcd / util4 / 0utils.lha / 0Utils / Suffix.data < prev    next >
Text File  |  1995-08-19  |  1KB  |  68 lines

  1.  
  2. #ifdef TPLTER
  3.  
  4. Suffix = {
  5.  
  6.     SHORT = {{ get a file's suffix }};
  7.  
  8.     DESCRIPTION = {{
  9.     Suffix gets a filename and extracts its suffix.
  10.  
  11.     The resulting string is sent to STDOUT.
  12.  
  13.      RESULT
  14.     a filename's suffix
  15.     }};
  16.  
  17.  
  18.     EXAMPLES = {{
  19.     >suffix a.b
  20.     b
  21.  
  22.     >suffix a
  23.            [nothing]
  24.  
  25.     > suffix ram:t/jabba.bak
  26.     bak
  27.     }};
  28.  
  29.     SEEALSO = {{
  30.     FilePart, PathPart
  31.     }};
  32.  
  33.     HISTORY = {{
  34.     01-08-93 b_noll created
  35.     20-02-95 b_noll restructured source
  36.     21-02-95 b_noll added version/format-prefix/offset
  37.     20-03-95 b_noll added args diagnostics
  38.     19-08-95 b_noll created .data file
  39.     }};
  40.  
  41.  
  42.     Template = "FILE/A";
  43.     Arguments = {{
  44.     STRPTR file;
  45.     }};
  46.  
  47.     version = "1.2";
  48.  
  49.     body = {{
  50.         STRPTR p;
  51.         p = argv->file;
  52.         retval = RETURN_WARN;
  53.         if (p && *p) {
  54.         while (*p) ++p;
  55.         --p;
  56.         while ((p != argv->file) && (*p != '.') && (*p != ':') && (*p != '/')) --p;
  57.         if (*p == '.') {
  58.             if (PutStr (p+1) == 0) retval = RETURN_OK;
  59.         } /* if */
  60.         } /* if */
  61.         PutStr("\n");
  62.  
  63.     }};
  64. };
  65.  
  66. #endif
  67.  
  68.